home *** CD-ROM | disk | FTP | other *** search
- Path: news.compuserve.com!newsmaster
- From: 100754.2730@compuserve.com (Martin Aupperle)
- Newsgroups: comp.lang.c++
- Subject: Re: [] overload..(newbie in distress)
- Date: Sun, 04 Feb 1996 21:56:14 GMT
- Organization: CompuServe Incorporated
- Message-ID: <4f3adi$aap@dub-news-svc-2.compuserve.com>
- References: <DLGppJ.31C@undergrad.math.uwaterloo.ca> <Robert.Lendvai-2101960118330001@129.170.80.94> <4dtuam$hf4@news.xmission.com> <ALUN.CHAMPION.96Jan22143422@g7240065.bridge.bst.bls.com> <4e12is$5no@engnews1.Eng.Sun.COM> <ALUN.CHAMPION.96Jan23151559@g7240065.bridge.bst.bls.com>
- NNTP-Posting-Host: ad21-080.compuserve.com
- X-Newsreader: Forte Free Agent v0.56
-
- Alun.Champion@bridge.bst.bls.com (Alun Champion) wrote:
-
- >In article <4e12is$5no@engnews1.Eng.Sun.COM> RAJU ALLURI <raju.alluri@Sun.COM> writes:
-
- >: Instead, if you use the third type of function for the constant objects,
- >: then some wicked fellow like me can do like
- > (int &)(ca[2]) = 200;
- >: and make the constant object changed!
-
- >This doesn't really hold much weight as some wicked fellow like me can
- >circumvent the constness of the ARRAY anyway like:
-
- > ((Array&)ca)[2] = 200;
-
- It does hold very much weight, because if you use type casts, you
- cannot argue about types any more. You loose all advantages of a
- strongly typed language. If you say explicitely to the compiler that a
- memory location has an object of type B where the creator created an
- object of type A, the compiler will allow to access the A object with
- B's semantics. Is this what you want? In that special case? In
- gegeral?
-
- This is the reason why there is a big difference between a cast that
- the compiler can do internally and an cast where an explicit notation
- is needed. The latter is a relict from VERY low level languages and
- should be generally banned from C++ (EXCEPT the one case: downcasting
- in an inheritance hierarchy, which is a language design flaw IMO).
-
- Martin
-
-
-
- -----------------------------------
- Signatures are a waste of bandwidth
- -----------------------------------
-
-